package fr.utbm;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class PatientList implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<Patient> patients;
	
	public PatientList() {
		patients = new ArrayList<Patient>();
	}
	
	public void addPatient(Patient p) {
		patients.add(p);
        Collections.sort(patients);
	}
	
	public List<Patient> getPatients() {
		return patients;
	}

	public int indexOf(Patient p) {
		return patients.indexOf(p);
	}

	public int size() {
		return patients.size();
	}

	public Patient get(int index) {
		return patients.get(index);
	}

	public void addPatient(User user) {
		Patient p = new Patient(user.getId(), user.getUsername(), user.getPassword(),
				user.getType(), user.getProfil_nom(), user.getProfil_prenom(), 
				user.getProfil_age(), user.getProfil_taille(), 
				user.getProfil_photo_url());
		addPatient(p);
	}

}
